﻿#pragma once

#ifndef EXTENDWIDGET_H
#define EXTENDWIDGET_H

#include <QtCore>
#include <QtWidgets>

#include "Extend.h"

class ExtendWidget : public QWidget
{
    Q_OBJECT
public:
    explicit ExtendWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
    virtual ~ExtendWidget();

public:
    bool getfirstPolish() { return (m_bWndPolish > 0); }
    bool getfirstShow() { return (m_bWndShow > 0); }
    bool getfirstLayout() { return (m_bWndLayout > 0); }
    bool getfirstPaint() { return (m_bWndPaint > 0); }

    bool getfirstPolished() { return (m_bWndPolish > 1); }
    bool getfirstShowed() { return (m_bWndShow > 1); }
    bool getfirstLayouted() { return (m_bWndLayout > 1); }
    bool getfirstPainted() { return (m_bWndPaint > 1); }

protected:
    int     m_bWndPolish;
    int     m_bWndShow;
    int     m_bWndLayout;
    int     m_bWndPaint;

protected:
    //窗口不显示时，只有Polish事件
    //生成Polished，Showed，Layouted，Painted事件
    //事件的顺序:0)Polish    1)Show   2)Layout   3)Paint
    //事件的顺序:0)Polished  1)Showed 2)Layouted 3)Painted
    virtual bool event(QEvent *event) override;

    virtual void firstPolishEvent(QEvent * event);
    virtual void firstPolishedEvent(QEvent * event);

    virtual void firstShowEvent(QEvent * event);
    virtual void firstShowedEvent(QEvent * event);

    virtual void firstLayoutEvent(QEvent * event);
    virtual void firstLayoutedEvent(QEvent * event);

    virtual void firstPaintEvent(QEvent * event);
    virtual void firstPaintedEvent(QEvent * event);

signals:

};

#endif // EXTENDWIDGET_H
